from django.db import models


class BaseModels(models.Model):
    name = models.CharField(max_length=32, verbose_name='性名')
    gender = models.SmallIntegerField(choices=[(0, '男'), (1, '女'), (2, '其他')], default=0, verbose_name='性别')
    data_birth = models.DateTimeField(verbose_name='出生日期')
    mobile = models.CharField(max_length=11, unique=True, verbose_name='电话')

    class Meta:
        abstract = True


class ModelRedMethod():
    def gender_name(self):
        return self.get_gender_display()

    def doctor_name(self):
        return self.doctor.name

    def department_type_name(self):
        return self.department.get_depart_type_display()

    def department_name(self):
        return self.department.name
